import {useEffect,useState} from "react"
import utils from '../utils/index'

export function useSearch(url,method){
    const [data,setData]=useState()

    useEffect(()=>{
        utils({
            url,
            method
        }).then(resp =>{
            setData(resp.data.data)
        })
    })

    return {data}
}